package com.cskaoyan.wordmemorize.controller.admin;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.cskaoyan.wordmemorize.common.result.Result;
import com.cskaoyan.wordmemorize.dao.entity.GoodsDO;
import com.cskaoyan.wordmemorize.dao.entity.OperateLogDO;
import com.cskaoyan.wordmemorize.dao.mapper.GoodsMapper;
import com.cskaoyan.wordmemorize.dao.mapper.OperateLogMapper;
import com.cskaoyan.wordmemorize.dto.admin.OperateLogDTO;
import com.cskaoyan.wordmemorize.dto.admin.PageDTO;
import com.cskaoyan.wordmemorize.request.OperateLogPageRequest;
import com.cskaoyan.wordmemorize.service.AdminLogService;
import org.apache.ibatis.executor.BatchExecutorException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 顾海龙
 * @version 1.0
 */
@RestController
@ResponseBody
public class AdminLogController{

    @Autowired
    AdminLogService adminLogService;

    @GetMapping("/admin/log/operation/list")
    public Result getAdminLog(@ModelAttribute OperateLogPageRequest operateLogPageRequest){
        PageDTO<OperateLogDTO> operateLogPage = null;
        try {
            operateLogPage = adminLogService.getOperateLogPage(operateLogPageRequest);
        } catch (BatchExecutorException e) {
            e.printStackTrace();
        }
        return Result.ok(operateLogPage);
    }
}
